package cl.tinet.trainee.bean;


import java.util.Date;
import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import cl.tinet.trainee.dao.CarroDAO;
import cl.tinet.trainee.dao.UsuarioDAO;
import cl.tinet.trainee.dto.CarroDTO;
import cl.tinet.trainee.dto.CarroDetalleDTO;
import cl.tinet.trainee.dto.ProductoDTO;
import cl.tinet.trainee.dto.UsuarioDTO;

/**
 * Session Bean implementation class CarroBean
 */
@Stateless
public class CarroBean implements CarroBeanLocal {
	@PersistenceContext(unitName="conexionTest")
	private EntityManager entityManager;
	
    private CarroDTO carroDto;
    
    private CarroDAO carroDao;
    /**
     * Default constructor. 
     */
    public CarroBean() {
        // TODO Auto-generated constructor stub
    }
    
    public boolean comprar(CarroDTO carroDto,List<CarroDetalleDTO> listaCarritoCompra){
    	carroDao=new CarroDAO(entityManager);
    	carroDao.comprar(carroDto,listaCarritoCompra);
    	return true;
    }

	public CarroDTO getCarroDto() {
		return carroDto;
	}

	public void setCarroDto(CarroDTO carroDto) {
		this.carroDto = carroDto;
	}

	public CarroDAO getCarroDao() {
		return carroDao;
	}

	public void setCarroDao(CarroDAO carroDao) {
		this.carroDao = carroDao;
	}

}
